#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "ActivityNode.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class ExceptionHandler;

/// <summary>
/// ExecutableNode
/// An ExecutableNode is an abstract class for ActivityNodes whose execution may be
/// controlled using ControlFlows and to which ExceptionHandlers may be attached.
/// </summary>
class UMLMODEL_EXPORT ExecutableNode : public ActivityNode {

public: // Constructors and destructors
    explicit ExecutableNode(const QString& umlType="uml::ExecutableNode");

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Properties
    /// <summary>
    /// handlers getter
    /// A set of ExceptionHandlers that are examined if an exception propagates out of
    /// the ExceptionNode.
    /// </summary>
    vector<shared_ptr<ExceptionHandler>>& handlers();

private: // Fields
    /// <summary>
    /// handlers
    /// A set of ExceptionHandlers that are examined if an exception propagates out of
    /// the ExceptionNode.
    /// </summary>
    vector<shared_ptr<ExceptionHandler>> handlers_;

};

} // namespace uml
